#ifndef VCONNECTION_H
#define VCONNECTION_H

#include <QFrame>


#include "Network/cudp.h"
struct StSocketInfo{
    StSocketInfo(QString _strIp,quint16 _nPort):strIp(_strIp),nPort(_nPort){}
    QString strIp;
    //    QHostAddress hostAddress;
    quint16 nPort;
};

extern StSocketInfo m_pSocketInfo;

namespace Ui {
class VConnection;
}

class VConnection : public QFrame
{
    Q_OBJECT

public:
    explicit VConnection(QWidget *parent = nullptr);
    ~VConnection();


    int m_nSendBytes = 0; //发送总字节数
    int m_nRecvBytes = 0; //接收总字节数
    QStringList m_strListBtnText;


    void slotArgReset();
    virtual void setConnectionProxy(CUdp *pConnect);
    void refreshIPList();
    void stateChanged(CUdp::EnmState enmState);

    virtual void connectStateChanged(QString strIp,quint16 nPort,bool bState){
        Q_UNUSED(strIp)
        Q_UNUSED(nPort)
        Q_UNUSED(bState)
    }
    virtual void dataArrive(QString strIp,quint16 nPort,QByteArray byteArr){
        Q_UNUSED(strIp)
        Q_UNUSED(nPort)
        Q_UNUSED(byteArr)
    }
    virtual void send(QByteArray byteArr){
        Q_UNUSED(byteArr)
    }


private slots:
    void on_pushButton_connect_clicked(bool checked);

private:
    Ui::VConnection *ui;
    CUdp *m_pConnect = nullptr;
protected:


};

#endif // VCONNECTION_H
